ADBOp
ADBOp Transmit command byte
#include <DeskBus.h> ADB Manager
OSErr ADBOp(data, compRout, buffer, commandNum );
Ptr data ; address of optional data area
ProcPtr compRout ; pointer to completion routine
Ptr buffer ; pointer to variable-length data buffer
short commandNum ; value given to the command byte
returns Error Code; 0=no error
Use ADBOp to send the command byte specified by the value in commandNum
field and instruct a bus-connected mouse or keyboard to SendReset, Flush,
Talk, or Listen.
data is an optional data area for local completion routine storage.
compRout is a completion routine structure.
buffer is a data area whose length is contained in its first byte.
commandNum is the value of the command byte signifying SendReset, Flush, Talk
or Listen.
Returns: an operating system Error Code. It will be one of:
noErr (0) No error
Err (-1) Unsuccessful completion

Notes: ADBOp executes only when the bus is idle. The rest of the time it is held
in a command queue. ADBOp returns an error if the command queue is full.
On entry, D0 holds the commandNum short and register AO contains a
pointer to a parameter block whose fields are:
Out-In Name Type Size Offset Description
-> buffer Ptr 4 0 Address of buffer for 8-bytes data
(max.), 1 byte length prefix
-> compRout Ptr 4 4 Completion routine address
-> data Ptr 4 8 Optional data area for local storage
compRout points to a completion routine which is passed the parameters
for:
1) commandNum in D0 (these are the commands to the device to:
SendReset, Flush, Listen and Talk);
2) a pointer in A0 to a buffer storing the bus device's send and receive data
as a variable length Pascal string (but not exceeding 8 data bytes and a
one-byte length prefix);
3) a pointer in A1 to the completion routine itself; and
4) a pointer in A2 to an optional data area designed to hold the completion
routine's data.
The completion routine is called when the ADBOp procedure has finished
execution and has the same meaning as the service routine passed to the
SetADBInfo procedure.
On exit, D0 holds the short signifying the result code that signals noErr
(0) or an unsuccessful completion (-1).
Apple Tech Note #206 points out some clarifications for the way
completion routines are called:
First, if you don't want to call a completion routine, pass a NIL Ptr to the
ADBOp routine.
Second, if you want to call a particular address's already-active routine,
call GetADBInfo before you call ADBOp and pass the routine pointer.
GetADBInfo returns to ADBOp .
Third, pass your own pointers to the ADBOp call if you want to set up
your own completion routine and data area.
There are also several bugs identified in the Tech Note.
For example, the Talk command up to and including System 6.0.4 for the
SE, SE/30, Mac II IIx and IIcx, returned an incorrect count byte when it
timed out.
The Listen command, likewise up to and including System 6.0.4 for the SE,
SE/30, Mac II IIx and IIcx transferred a different number of bytes than the
supplied count byte.
The Listen command up to and including System 6.0.4 for the Mac Por table
sends spurious data in the 7th and 8th bytes for any data count higher than
6.
A bug in the Macintosh SE, SE/30, Mac II, IIx, and IIcx implementations of
the ADB Manager up to and including System 6.0.4 resulted in the
completion routines passed to the ADBOp routine not always being called.